package com.psychologyCommunity.Community.entity;

import com.psychologyCommunity.Community.util.MailClient;
import org.apache.kafka.common.protocol.types.Field;

import java.util.HashMap;
import java.util.Map;

public class Event {
    //事件的类型Topic ，从kafka的角度来说就是topic，
    private String topic;
    // 并且事件是谁 发出的 加以记录，--例如：张三给李四的帖子点赞
    private int userId; //--张三
    //并且要知道这个事件发生在哪个实体之上
    private int entityType;
    private int entityId;//是给帖子 、还是评价、还是回复 的Id
    private int entityUserId;//--李四的id 即被点赞的帖子的id
    //其他额外的数据存在map里，让他具有一定的拓展性
    private Map<String,Object> data=new HashMap<>();

    public String getTopic() {
        return topic;
    }

    public Event setTopic(String topic) {
        this.topic = topic;
        return this;
    }

    public int getUserId() {
        return userId;
    }

    public Event setUserId(int userId) {
        this.userId = userId;
        return this;
    }

    public int getEntityType() {
        return entityType;
    }

    public Event setEntityType(int entityType) {
        this.entityType = entityType;
        return this;
    }

    public int getEntityId() {
        return entityId;
    }

    public Event setEntityId(int entityId) {
        this.entityId = entityId;
        return this;
    }

    public int getEntityUserId() {
        return entityUserId;
    }

    public Event setEntityUserId(int entityUserId) {
        this.entityUserId = entityUserId;
        return this;
    }

    public Map<String, Object> getData() {
        return data;
    }

    public Event setData(String key, Object value) {
        this.data.put(key, value);
        return this;
    }
}
